package dynamicProgramming.review6_1;

public class BagProblem2 {

    public  static  void  test(int[]  weight,int[]  value,int bagWeight){


        int length = weight.length;
        int[]  dp=new int [bagWeight+1];


        for (int i = 0; i < length; i++) {

            for (int j = bagWeight; j >=weight[i]; j--) {

                dp[j]=Math.max(dp[j],dp[j-weight[i]]+value[i] );
            }

        }


        for (int i = 0; i <bagWeight ; i++) {
            System.out.println(dp[i]+"");
        }

    }

}
